package com.wryyyyy.service.impl;

import com.wryyyyy.dto.PageBean;
import com.wryyyyy.dto.Result;
import com.wryyyyy.entity.Label;
import com.wryyyyy.mapper.LabelMapper;
import com.wryyyyy.service.ILabelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wryyyyy
 * @since 2023-11-12
 */
@Service
public class LabelServiceImpl extends ServiceImpl<LabelMapper, Label> implements ILabelService {
    @Resource
    private LabelMapper labelMapper;

    @Override
    public Result userQueryInCondition(String name, String userId, Integer current, Integer size) {
        Integer start = (current - 1) * size;
        List<Label> labels = labelMapper.userSelectInCondition(name, userId, start, size);
        Integer count = labelMapper.userCountInCondition(name, userId);
        return Result.ok(new PageBean<>(labels, count));
    }
}
